package customer.zspt.cn.customer.Adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.lidroid.xutils.BitmapUtils;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

import java.util.List;

import customer.zspt.cn.customer.R;
import customer.zspt.cn.customer.bean.OrderStateDao;

/**
 * Created by Administrator on 2018/7/18 0018.
 */

public class OrderMsgAdapter extends BaseAdapter {
    private List<OrderStateDao.OrderState> msg_ls;
    private Context mContext;
    @ViewInject(R.id.user_header_ig)
    private ImageView user_header_ig;
    @ViewInject(R.id.userName)
    private TextView userName;
    @ViewInject(R.id.msg)
    private TextView msg;
    private BitmapUtils utils;
    public OrderMsgAdapter(List<OrderStateDao.OrderState> msg_ls,Context context){
         this.msg_ls = msg_ls;
          mContext = context;
          utils = new BitmapUtils(context);
    }
    @Override
    public int getCount() {
        return msg_ls.size();
    }
    @Override
    public Object getItem(int position) {
        return msg_ls.get(position);
    }
    @Override
    public long getItemId(int position) {
        return position;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = View.inflate(mContext, R.layout.order_sc_msg_item,null);
        ViewUtils.inject(this,view);
        utils.display(user_header_ig,msg_ls.get(position).kefu.kefuAvatar);
        userName.setText(msg_ls.get(position).kefu.kefuUsername);
        msg.setText(msg_ls.get(position).orderReplyContent);
        return view;
    }
}
